import { Controller, Get, Post, Body, Patch, Param, Delete, Query } from '@nestjs/common'
import { SectionService } from './section.service'
import { CreateSectionDto } from './dto/create-section.dto'
import { UpdateSectionDto } from './dto/update-section.dto'

@Controller('section')
export class SectionController {
  constructor(private readonly sectionService: SectionService) {}

  @Post()
  create(@Body() createSectionDto: CreateSectionDto) {
    return this.sectionService.create(createSectionDto)
  }

  @Get('/calc/')
  async calc(@Query() args = {}) {
    return await this.sectionService.calcP(args)
  }

  @Get('/calc/towerPoints')
  async calcTowerPoints(@Query() args = {}) {
    return await this.sectionService.calcTowerPoints(args)
  }

  @Get()
  async findAll(@Query() args = {}) {
    return await this.sectionService.findAll(args)
  }

  @Get(':id')
  findOne(@Param('id') id: string) {
    return this.sectionService.findOne(+id)
  }

  @Patch(':id')
  update(@Param('id') id: string, @Body() updateSectionDto: UpdateSectionDto) {
    return this.sectionService.update(+id, updateSectionDto)
  }

  @Delete(':id')
  async remove(@Param('id') id: string) {
    return await this.sectionService.remove(+id)
  }
}
